--HEADER Fixed merge issue: iComply.ComplianceEvent added fundbook and TPH

IF EXISTS(SELECT * FROM sys.columns 
        WHERE [name] = N'Determinator' AND [object_id] = OBJECT_ID(N'[iComply].[ComplianceEvent]'))
BEGIN
	exec sp_rename 'iComply.ComplianceEvent.Determinator', 'Discriminator', 'COLUMN'    
END


IF NOT EXISTS(SELECT * FROM sys.columns 
        WHERE [name] = N'FundBookEntityId' AND [object_id] = OBJECT_ID(N'[iComply].[ComplianceEvent]'))
BEGIN
	alter table iComply.ComplianceEvent
	add FundBookEntityId int null
END

GO


IF NOT EXISTS(SELECT * FROM sys.columns 
        WHERE [name] = N'EventName' AND [object_id] = OBJECT_ID(N'[iComply].[ComplianceEvent]'))
BEGIN
	alter table iComply.ComplianceEvent
	add [EventName]  AS ([Discriminator])
END
